package com.itheima.shop.user;

import org.springframework.stereotype.Component;

/**
 * @program: design
 * @description:
 * @author: zhanghz001
 * @create: 2020-12-15 09:46
 **/
@Component
public class SessionThreadLocal {
    private ThreadLocal<SessionShare> sessions = new ThreadLocal<>();
    
    public void addSession(SessionShare sessionShare) {
        sessions.set(sessionShare);
    }
    
    public void remove() {
        sessions.remove();
    }
    
    public SessionShare get() {
        return sessions.get();
    }
}
